package com.qy139.card.controller;


import com.qy139.card.service.ICardTypeService;
import com.qy139.entity.CardType;
import com.qy139.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yuhaochen
 * @since 2021-11-30
 */
@RestController
@RequestMapping("/card-type")
public class CardTypeController {
    @Resource
    private ICardTypeService cardTypeService;
    //基础全表查询
    @GetMapping("/findAllCard")
    public Result findAllCard(){
        return new Result(cardTypeService.list());
    }
    //卡片新增
   /* @PostMapping("/addCardType")
    public Result addCardType (@RequestBody CardType cardType){
        return new Result(cardTypeService.save(cardType));
    }*/
//新增、修改和逻辑删除
    @PutMapping("/updCardType")
    public Result updCardType(@RequestBody CardType cardType){
        cardType.setUpdatetime(new Date());
        return new Result(cardTypeService.saveOrUpdate(cardType));
    }
//物理删除
   /* @DeleteMapping("/del/{id}")
    public Result deleteCardType(@PathVariable("id") Integer id){
        return new Result(cardTypeService.removeById(id));
    }*/

    @GetMapping("/showType")
    public Result showType(){
        return new Result(cardTypeService.showType());
    }

}

